package com.example.springboot2.controller;

import com.example.springboot2.model.ReadList;
import com.example.springboot2.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
public class UserController {

    @Value("${server.port}")  // 读取配置文件
    private String port;

    @Autowired
    private Student student1;

    @Resource
    private ReadList readList;


    @ResponseBody  // 返回一个非静态页面的数据
    @RequestMapping("/sayhi")  //设置理由地址
    public String sayHi(){
        return "readList: " + readList.getName();
    }


}
